/**
 * Created with JetBrains WebStorm.
 * User: ishowshao
 * Date: 13-5-8
 */
define(['Zen'], function (Zen) {
    return Zen.extend(Zen.View, {
        init: function () {
            this.el = jQuery('<div class="users"></div>');
        },
        refresh: function (users) {
            this.el.empty();
            for (var i = 0; i < users.length; i++) {
                this.el.append('<div data-id="' + users[i].id + '">' + users[i].name + '</div>');
            }
        },
        add: function (user) {
            this.el.append('<div data-id="' + user.id + '">' + user.name + '</div>');
        },
        remove: function (user) {
            this.el.find('[data-id=' + user.id + ']').remove();
        }
    });
});
